var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
var user = require('../../../utils/user.js');
const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
      userInfo: {
        nickName: 'EXIF编辑器',
        avatarUrl: '/static/images/avatar.png'
      },
      canGoLogin: false,
      canGoLogout: false,
      allProjects: [],
      taskRefreshTip: 'V2.0.1',
      order: {
        unpaid: 0,
        unship: 0,
        unrecv: 0,
        uncomment: 0
      },
    MyMenus: [
     
      ],
      hasLogin: false,
      totalAmount: 0.00
  },

  /**
   * 页面跳转
  */
  goPages:function(e){
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },




  setNotLogin(){
    
  },

  setInLogin(){
    
  },
  goLogout: function(){
    
    
  },
  onShow:function(){
    


  },

  initTasks(){
    
  },

  /**
  * 生命周期函数--监听页面卸载
  */
  onUnload: function () {

  },


  goLogin() {
    var loginType = 1
    if (!this.data.hasLogin) {
      wx.navigateTo({
        url: loginType==1?'/pages/auth/accountLogin/accountLogin': "/pages/auth/login/login"
      });
    }
  },
  goBrokerage() {
    if (this.data.hasLogin) {
      wx.navigateTo({
        url: "/pages/brokerage/main/main"
      });
    } else {
      wx.navigateTo({
        url: "/pages/auth/login/login"
      });
    };
  },
  goOrder() {
    if (this.data.hasLogin) {
      try {
        wx.setStorageSync('tab', '0');
      } catch (e) {

      }
      wx.navigateTo({
        url: "/pages/ucenter/order/order"
      });
    } else {
      wx.navigateTo({
        url: "/pages/auth/login/login"
      });
    }
  },
  goOrderIndex(e) {
    if (this.data.hasLogin) {
      let tab = e.currentTarget.dataset.index
      let route = e.currentTarget.dataset.route
      try {
        wx.setStorageSync('tab', tab);
      } catch (e) {

      }
      wx.navigateTo({
        url: route,
        success: function (res) { },
        fail: function (res) { },
        complete: function (res) { },
      })
    } else {
      wx.navigateTo({
        url: "/pages/auth/login/login"
      });
    };
  },
  goAfterSale: function () {
    wx.showToast({
      title: '目前不支持',
      icon: 'none',
      duration: 2000
    });
  }
})